package com.example.test.启动线程.高并发容器;

import lombok.Data;
import lombok.NoArgsConstructor;

@NoArgsConstructor
public class ReadTask implements Runnable {

    private DRDictionary drDictionary;

    public ReadTask(DRDictionary drDictionary) {
        this.drDictionary = drDictionary;
    }

    @Override
    public void run() {
        while (true) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            String[] allKeys = drDictionary.allKeys();
            for (String allKey : allKeys) {
                System.out.println(allKey + ":" + drDictionary.get(allKey));
            }
        }
    }
}
